  <gm:page title="mypage">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Google Maps JavaScript API Example</title>
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAA0vnOHxSJO3kBtQ6USQqhsBTZjOzCq1zaSVYYR2Hjfh7G7BQqdhQknbovigVXmQkaZ1CMdSuugPswkQ"
      type="text/javascript"></script>
    <script type="text/javascript">
    //<![CDATA[
   function testi() {
    }
    function testi2() {
  window.open();
    } 
    var map;
    var geocoder;
    var country;
 
    function initialize() {
      if (GBrowserIsCompatible()) {
        
    map = new GMap2(document.getElementById("map"));
    map.setCenter(new GLatLng(34, 0), 2);
    map.setMapType(G_NORMAL_MAP);
    map.addControl(new GLargeMapControl());
    map.addControl(new GScaleControl());
    map.addControl(new GMapTypeControl());
    map.addControl(new GOverviewMapControl());
    geocoder = new GClientGeocoder(); } 
    }
 
// addAddressToMap() is called when the geocoder returns an
// answer. It adds a marker to the map with an open info window
// showing the nicely formatted version of the address and the country code.
function addAddressToMap(response) {
map.clearOverlays();
if (!response || response.Status.code != 200) {
alert("Sorry, we were unable to geocode that address");
} else {
place = response.Placemark[0];   
point = new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]);
marker = new GMarker(point);
map.addOverlay(marker);
marker.openInfoWindowHtml(place.address + '<br/>' +
'<b>Country code:</b> ' + place.AddressDetails.Country.CountryNameCode);
var str = place.address; //various possiblities: Russia, oghfhgls; Vantaa, Finland
var j = str.lastIndexOf(",") + 2;
country = str.substr(j);    
// var city = place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.LocalityName;
var lat = parse(place.Point.coordinates[1]);
var long = parse(place.Point.coordinates[0]);
switchData(lat, long, country);
}
}

//parses the coordinates to have six numbers after dot and removes the dot
function parse(coord) {
coord = coord.toString();
var pointOfPoint = coord.indexOf('.');
var length = coord.substr(pointOfPoint+1).length;
if(length <= 5) {
for(i=0;i <= 5-length; i++) {
var zero = '0'
coord = coord.concat(zero);
}
}
coord = coord.replace('.',""); 
return coord;
}









// showLocation() is called when you click on the Search button
// in the form. It geocodes the address entered into the form
// and adds a marker to the map at that location.
function showLocation() {
var address = document.forms[0].q.value;
onLoad2(address);
geocoder.getLocations(address, addAddressToMap);
}








// findLocation() is used to enter the sample addresses into the form.
function findLocation(address) {
document.forms[0].q.value = address;
showLocation();
}








//updates the weather list 
function switchData(lat, long, country) {
var listModule = google.mashups.getObjectById('weatherList');
var newFeed = 'http://pipes.yahoo.com/pipes/pipe.run?_id=3891865d63d8aa8778b4aa110228df38&_render=rss&textinput1=%2C%2C%2C' + lat + '%2C' + long + '&textinput2=' + country + '';
listModule.setData(newFeed);
}
    //]]>
    </script>
  </head>
  <body onload="initialize()" onunload="GUnload()">
 <!-- Creates a simple input box where you can enter an address
and a Search button that submits the form. //-->
<form action="#" onsubmit="showLocation(); return false;">
<p>
<b>Search for an address:</b>
<input type="text" name="q" value="" class="address_input" size="40" />
<input type="submit" name="find" value="Search" />
</p>
</form>
    <div id="map" style="width: 500px; height: 300px"></div>
<p><b>Try these:</b>
<a href="javascript:void(0)"
onclick="findLocation('Strömbergintie 1, Helsinki, Finland');return false;">
Strömbergintie 1, Helsinki, Finland</a> 
</p>
  </body>
  <script src="http://www.google.com/jsapi?key=ABQIAAAA0vnOHxSJO3kBtQ6USQqhsBTZjOzCq1zaSVYYR2Hjfh7G7BQqdhQknbovigVXmQkaZ1CMdSuugPswkQ" type="text/javascript"></script> 
<style type="text/css">

body {
background-color: white;
color: black;
font-family: Arial, sans-serif;
font-size : 13px;
margin: 15px;
text-align: left;
}

#searchcontrol .gsc-control { position:absolute; width : 400px; top: 48px; left: 550px;

</style>
<script type="text/javascript">
//<![CDATA[

google.load('search', '1.0'); 

function initializeSearch() {
var searchController = new google.search.SearchControl(); 
searchController.draw(document.getElementById("searchcontrol"));
searchController.execute();
}

function onLoad2(address) {
// Create a search control
var searchController = new google.search.SearchControl(); 

// Add search 
searchController.addSearcher(new google.search.WebSearch());

// tell the searcher to draw itself and tell it where to attach
searchController.draw(document.getElementById("searchcontrol"));

// execute the search
searchController.execute(address);
}

google.setOnLoadCallback(initializeSearch); 

//]]>
</script>
   <body>
    <div id="searchcontrol">Loading...</div>
   </body>
   
<gm:template id="myItemTemplate">
    <table style="position:relative; top: 20px; width:500px">
      <tr repeat="true">
        <td>  
          <p align="center">
            <b><gm:text ref="atom:title"/></b>
            <br/>
            <gm:text ref="atom:summary"/>
            <br/>
            <gm:image ref="atom:link/@href"/>
          </p>
        </td>
      </tr>
    </table>
  </gm:template>
 
  <gm:list id="weatherList" data="http://pipes.yahoo.com/pipes/pipe.run?_id=3891865d63d8aa8778b4aa110228df38&_render=rss&textinput1=%2C%2C%2C39930000%2C116279998&textinput2=China" template="myItemTemplate"/>

</gm:page>
